package com.gdcp.mapper;

import com.gdcp.beans.Category;
import com.gdcp.beans.Product;
import com.gdcp.beans.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface ProductMapper {

    int insert(Product record);

    List<Product> findPageBreakByCondition(Map<String, Object> param);

    int removeByPrimaryKey(@Param(value = "id") Integer id);

    int updateByPrimaryKey(Product product);

    Product getInformation(Integer userId);

    List<Product> searchInformation(Map<String, Object> param);

    List<Product> queryByCreateTime();

    List<Product> queryByLimit(@Param(value = "id") Integer parent_id, @Param(value = "startRow")  int startRow, @Param(value = "pageSize")  int pageSize);

    List<Product> getPageNumber(@Param(value = "category_id") Integer category_id, @Param(value = "min") Integer min, @Param(value = "max") Integer max);

    List<Product> findByKeyWord(@Param(value = "category_id") Integer cid, @Param(value = "pc") int pc, @Param(value = "ps") int ps, @Param(value = "keyword") String keyword, @Param(value = "sort") String sort, @Param(value = "min") Integer min, @Param(value = "max") Integer max);

    List<Product> queryProductsByCid(@Param(value = "category_id") Integer category_id);

    List<Product> queryAllByShopId(@Param(value = "shop_id") Integer shopId);

    List<Product> queryShopProductByShopId(@Param(value = "shop_id") Integer shop_id);

    List<Product> queryProductByShopId(@Param(value = "id") Integer shop_id);

    List<Product> searchByKeyWord(@Param(value = "category_id") Integer cid, @Param(value = "pc") int pc, @Param(value = "ps") int ps, @Param(value = "search_key") String search_key, @Param(value = "column") String column, @Param(value = "sort") String sort, @Param(value = "min") Integer min, @Param(value = "max") Integer max);

    int updateSaleCount(@Param(value = "id") Integer product_id);

    int updatePopularity(@Param(value = "id") Integer product_id);

    List<Product> queryByPopularity();

    List<Product> queryBySale_count();

    List<Product> queryByParentId(@Param(value = "category_id") Integer id);

    List<Product> findPageBreakByConditionByShopId(Integer shop_id);

    List<Product> findAll(Map<String, Object> model);

    List<Product> getPageNumberBySearch(@Param(value = "keyword") String keyword, @Param(value = "min") Integer min, @Param(value = "max") Integer max);

    List<Category> searchInformationByShopId(Map<String, Object> model);

    List<Category> searchSizeByShopId(@Param(value = "shop_id") Integer shop_id);
}
